Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TCX support #1478

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Add TCX support #1478

wants to merge 8 commits into from

Conversation

rafaelroquetto
Copy link
Contributor

@rafaelroquetto rafaelroquetto commented Dec 20, 2024

This PR refactors and replaces the TC attachment code to enable the usage of TCX, introduced in Linux 6.6, for traffic control attachments. The TCX interface provides several advantages in relation to the legacy netlink attachment such as, the ability to easily chain attach tc filters to a given interface and to bypass/ignore the creation of clsact qdiscs altogether, to name a few.

The old netlink-based attachment code has been replaced by an interface called TCManager, for which two implementations are provided: one that continues to use netlink, and another that relies on TCX. A new configuration option called BEYLA_BPF_TC_BACKEND has been introduced to allow the user to select which backend to use (originally I had intended to auto detect it, but that proved to be more complicated than what I'd anticipated so I decided to drop it for now, to get this out of the door). The default backend continues to be the legacy netlink one, making tcx effectively an opt-in feature to prevent unintended breakages.

This also completes the work of bringing together the tracers and netolly attachment code.

This is a big PR and is best reviewed on a per-commit basis.

@rafaelroquetto rafaelroquetto added the do-not-merge WIP or something that musn't be merged label Dec 20, 2024
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 49.12023% with 347 lines in your changes missing coverage. Please review.

Project coverage is 80.19%. Comparing base (acf7ad7) to head (28d807f).

Files with missing lines Patch % Lines
pkg/internal/ebpf/tcmanager/tcxmanager.go 3.24% 179 Missing ⚠️
pkg/internal/ebpf/tcmanager/netlinkmanager.go 62.96% 90 Missing and 20 partials ⚠️
pkg/internal/ebpf/tcmanager/tcmanager.go 59.37% 13 Missing ⚠️
pkg/internal/ebpf/tcmanager/util.go 0.00% 13 Missing ⚠️
pkg/internal/ebpf/tcmanager/filter.go 80.32% 8 Missing and 4 partials ⚠️
pkg/internal/netolly/agent/agent.go 77.27% 10 Missing ⚠️
pkg/internal/ebpf/httptracer/httptracer.go 77.77% 2 Missing and 2 partials ⚠️
pkg/beyla/config.go 0.00% 2 Missing and 1 partial ⚠️
pkg/internal/ebpf/tctracer/tctracer.go 82.35% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1478      +/-   ##
==========================================
- Coverage   81.44%   80.19%   -1.25%     
==========================================
  Files         149      153       +4     
  Lines       15268    15619     +351     
==========================================
+ Hits        12435    12526      +91     
- Misses       2233     2485     +252     
- Partials      600      608       +8     
Flag Coverage Δ
integration-test 58.61% <43.54%> (-1.19%) ⬇️
k8s-integration-test 58.73% <43.98%> (-1.23%) ⬇️
oats-test 33.23% <0.58%> (-0.78%) ⬇️
unittests 51.52% <17.74%> (-0.57%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This is a variant of the existing interface filter present in the
'agent' package.
@rafaelroquetto rafaelroquetto force-pushed the tcx_support branch 2 times, most recently from f49b69b to 6588c47 Compare January 8, 2025 00:53
@rafaelroquetto rafaelroquetto changed the title WIP: Add TCX support Add TCX support Jan 8, 2025
@rafaelroquetto rafaelroquetto added documentation Improvements or additions to documentation and removed do-not-merge WIP or something that musn't be merged labels Jan 8, 2025
@rafaelroquetto rafaelroquetto marked this pull request as ready for review January 8, 2025 01:13
@rafaelroquetto rafaelroquetto requested a review from a team as a code owner January 8, 2025 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant